package com.matrix.calculator;

import java.util.ArrayList;

import com.matrix.math.ColumnVector;

public class GlobalVars{
	private static GlobalVars mInstance = null;
	private ArrayList<com.matrix.math.Matrix> currentMatrices = new ArrayList<com.matrix.math.Matrix>();
	private ArrayList<ColumnVector> currentVectors = new ArrayList<ColumnVector>();
	private ArrayList<com.matrix.math.Matrix> resultMatrices = new ArrayList<com.matrix.math.Matrix>();
	private ArrayList<ColumnVector> resultVectors = new ArrayList<ColumnVector>();
	public static synchronized GlobalVars getInstance()
	{        
		if(null == mInstance)
		{                
			mInstance = new GlobalVars();        
		}        
		return mInstance;    
	}
	public void addMatrix(com.matrix.math.Matrix m)
	{
		currentMatrices.add(m);
	}
	public void removeMatrix(com.matrix.math.Matrix m)
	{
		currentMatrices.remove(m);
	}
	public void setResultMatrices(ArrayList<com.matrix.math.Matrix> results)
	{
		resultMatrices = results;
	}
	public void addResultMatrix(com.matrix.math.Matrix r)
	{
		resultMatrices = new ArrayList<com.matrix.math.Matrix>();
		resultMatrices.add(r);
	}
	public ArrayList<com.matrix.math.Matrix> getResultMatrices()
	{
		return resultMatrices;
	}
	public void addVector(ColumnVector v)
	{
		currentVectors.add(v);
	}
	public void removeVector(ColumnVector v)
	{
		currentVectors.remove(v);
	}
	public void setResultVectors(ArrayList<ColumnVector> vl)
	{
		resultVectors = vl;
	}
	public ArrayList<ColumnVector> getResultVectors()
	{
		return resultVectors; 
	}
}
